﻿using AutoMapper;

namespace TestminiApi.Extend
{
    public static class Extend
    {
        public static T MapTo<T>(this object obj)
        {
            if (obj == null) return default(T);
            var config = new MapperConfiguration(cfg => cfg.CreateMap(obj.GetType(), typeof(T)));
            var mapper = config.CreateMapper();
            return mapper.Map<T>(obj);
        }
    }
}
